home *** CD-ROM | disk | FTP | other *** search
- Path: solon.com!not-for-mail
- From: schwarz@a3.complang.tuwien.ac.at (Konrad Schwarz)
- Newsgroups: comp.lang.c.moderated,comp.lang.c,comp.std.c
- Subject: Re: HELP IN WRITING MY FIRST PROGRAM ASSINGMENT
- Date: 26 Feb 1996 07:07:01 -0600
- Organization: TU Wien
- Sender: clc@solutions.solon.com
- Approved: clc@solutions.solon.com
- Message-ID: <4gsb9l$46a@solutions.solon.com>
- References: <3127FF7A.6442C3B8@eden.com> <4gfhkj$3p8@solutions.solon.com> <4ggbi9$83k@solutions.solon.com> <4ghnnc$dj9@solutions.solon.com> <4ghoam$dp4@solutions.solon.com>
- NNTP-Posting-Host: solutions.solon.com
-
- In article <4ghoam$dp4@solutions.solon.com>, seebs@solutions.solon.com (Peter Seebach) writes:
-
- [qsort problem]
-
- |> To clarify: I believe it is incorrect for the library to do so; although
- |> it's pretty tenuous, the "which is called with two arguments that point to
- |> the objects being compared" seems to mean that to me. My rationale is that
- |> the compiler *cannot* prove that the objects do not depend on being parts
- |> of a larger array. For instance, consider an array of 200 objects; sort
- |> the first 100, with a comparison routine that compares not only the objects,
- |> but the objects 100 further in the "real" array. I believe this to be
- |> conforming.
-
- The qsort routine rearranges the array passed to it. I don't think it
- is possible for the comparision function to sort the real array 100 objects
- further on in lockstep with the qsort routine, without relying on the
- algorithm of qsort---which is implementation defined. In this
- case, the comparision function is not well-defined, since at some call,
- a < b, later, a > b.
-
- By the way, what is the relation of the ``quicker sort algorithm'' mentioned
- in many manuals to the classic quick sort algorithm? Is it best-of-three?
-
- Konrad Schwarz
-